plat: zynqmp: Don't panic() if we can't find the FSBL struct
authorAlistair Francis <[email protected]>
Fri, 1 Dec 2017 00:21:21 +0000 (16:21 -0800)
committerSiva Durga Prasad Paladugu <[email protected]>
Thu, 17 May 2018 09:48:32 +0000 (15:18 +0530)
If we can't find the FSBL handoff struct don't panic and just use the
defaults instead.

We still print a warning to the user to let them know what we couldn't
find it.

Signed-off-by: Alistair Francis <[email protected]>
Acked-by: Michal Simek <[email protected]>
Reviewed-by: Siva Durga Prasad Paladugu <[email protected]>
plat/xilinx/zynqmp/bl31_zynqmp_setup.c
plat/xilinx/zynqmp/plat_startup.c

index 6dc1c2d22ae06dd04443d51dc69528467b6468fe..471b1cc60095d952cebda208baf02fabde9363f8 100644 (file)
@@ -35,6 +35,19 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
        return &bl32_image_ep_info;
 }
 
+/*
+ * Set the build time defaults. We want to do this when doing a JTAG boot
+ * or if we can't find any other config data.
+ */
+static inline void bl31_set_default_config(void)
+{
+       bl32_image_ep_info.pc = BL32_BASE;
+       bl32_image_ep_info.spsr = arm_get_spsr_for_bl32_entry();
+       bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
+       bl33_image_ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
+                                         DISABLE_ALL_EXCEPTIONS);
+}
+
 /*
  * Perform any BL31 specific platform actions. Here is an opportunity to copy
  * parameters passed by the calling EL (S-EL1 in BL2 & S-EL3 in BL1) before they
@@ -69,17 +82,14 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
        SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
 
        if (zynqmp_get_bootmode() == ZYNQMP_BOOTMODE_JTAG) {
-               /* use build time defaults in JTAG boot mode */
-               bl32_image_ep_info.pc = BL32_BASE;
-               bl32_image_ep_info.spsr = arm_get_spsr_for_bl32_entry();
-               bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
-               bl33_image_ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
-                                                 DISABLE_ALL_EXCEPTIONS);
+               bl31_set_default_config();
        } else {
                /* use parameters from FSBL */
                enum fsbl_handoff ret = fsbl_atf_handover(&bl32_image_ep_info,
                                                          &bl33_image_ep_info);
-               if (ret != FSBL_HANDOFF_SUCCESS)
+               if (ret == FSBL_HANDOFF_NO_STRUCT)
+                       bl31_set_default_config();
+               else if (ret != FSBL_HANDOFF_SUCCESS)
                        panic();
        }
 
index 32c2db720dbed09108e371329b05a5a00678e20b..d3e182cac5e463d81712d2bdf3367be4bea3a7c6 100644 (file)
@@ -161,7 +161,7 @@ enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t
        assert((atf_handoff_addr < BL31_BASE) ||
               (atf_handoff_addr > (uint64_t)&__BL31_END__));
        if (!atf_handoff_addr) {
-               ERROR("BL31: No ATF handoff structure passed\n");
+               WARN("BL31: No ATF handoff structure passed\n");
                return FSBL_HANDOFF_NO_STRUCT;
        }